{
  "properties" : { },
  "id" : "0139b87c0e054c629f0fe6b194a7bbc0",
  "script" : null,
  "groupId" : "b56a24453f064cf8bf33b13a4a2a6d91",
  "name" : "查询运行监视列表",
  "createTime" : 1727071147516,
  "updateTime" : 1726799717248,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "getMonitorPage",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\r\n\"current\":2,\r\n\"size\":1\r\n\r\n}",
  "headers" : [ {
    "name" : "blade-auth",
    "value" : "bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJpc3N1c2VyIiwiYXVkIjoiYXVkaWVuY2UiLCJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJyb2xlX25hbWUiOiJhZG1pbmlzdHJhdG9yIiwicG9zdF9pZCI6IjExMjM1OTg4MTc3Mzg2NzUyMDEiLCJ1c2VyX2lkIjoiMTEyMzU5ODgyMTczODY3NTIwMSIsInJvbGVfaWQiOiIxMTIzNTk4ODE2NzM4Njc1MjAxIiwidXNlcl9uYW1lIjoiYWRtaW4iLCJuaWNrX25hbWUiOiLnrqHnkIblkZgiLCJkZXRhaWwiOnsidHlwZSI6IndlYiJ9LCJ0b2tlbl90eXBlIjoiYWNjZXNzX3Rva2VuIiwiZGVwdF9pZCI6IjE3OTM0OTQ0MTgwODMzMTk4MTAiLCJhY2NvdW50IjoiYWRtaW4iLCJjbGllbnRfaWQiOiJzYWJlciIsImV4cCI6MTcyNjI3ODU3MSwibmJmIjoxNzI2Mjc0OTcxfQ.ou1t5_5THA_VbKnD7uhpvNOKgtBSQKvuvBcUQ6BA9Sz4100GSumnsEzmb8L8iaDSDZbvn2-qmWMIR84MI_n1dA",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  } ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 0,\n        \"current\": 2,\n        \"size\": 1,\n        \"records\": \"\"\n    }\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "500",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "success",
      "value" : "false",
      "description" : "",
      "required" : false,
      "dataType" : "Boolean",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "msg",
      "value" : "系统维护中，请稍后重试。",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import redis

 

private final static String DEVICE_TYPE_ROUTE = "1";
private final static String ROUTE = "路由器";
private final static String SWITCH = "交换机";

private final static String NET_NORMAL_FLAG = "1";
private final static String NET_NORMAL = "网络正常";
private final static String NET_ABNORMAL = "网络异常";

private final static String GATHER_FLAG = "RUNNING";
private final static String GATHER = "已采集";
private final static String NOT_GATHER = "未采集";

var token = header.get("blade-auth")::string;
var dccId = redis.get(token.substring(7))

var sql = """
  SELECT
            d.ID device_id,
            d.device_Name,
            d.ip,
            M.device_model model,
            d.device_type,
            l.reachable net_status,
            l.status gather_status
        FROM
        ndmp_device d
            LEFT JOIN ndmp_net_device_model_info M ON M.ID = d.DEVICE_MODEL_ID
            left join  da_link l on d.id=l.task_id
        where 1=1 and d.dcc_id=#{dccId}
        <if test="body.deviceName != null and body.deviceName != '' ">
            and d.device_name like concat('%',#{body.deviceName},'%')
        </if>
        <if test="body.ip != null and body.ip != '' ">
            and d.ip like concat('%',#{body.ip},'%')
        </if>
"""

var res = db.page(sql,body.size ,body.current-1)
if(res==null || res.records==null){
return res.recvords=[];
}
for (vo in res.records) {


    // 软件版本
    var pointSoftVersion = redis.getPoint(vo.deviceId, "softVersion");
    var softVersion = "";
    if (null != pointSoftVersion) {
        softVersion = pointSoftVersion.value.get("0")
    }
    vo.softVersion = softVersion;

    // // 在线时间
    var pointSysUpTime = redis.getPoint(vo.deviceId, "sysUpTime");
    var sysUpTime = "";
    if (null != pointSysUpTime) {
        sysUpTime = pointSysUpTime.value.get("0")
    }
    vo.sysUpTime = sysUpTime;



    if (null != vo.deviceType) {
        //设备类型
        if (vo.deviceType.equals(DEVICE_TYPE_ROUTE)) {
            vo.ddeviceType = ROUTE;
        } else {
            vo.deviceType = SWITCH;
        }
    }


    //网络状态
    if (NET_NORMAL_FLAG.equals(vo.netStatus)) {
        vo.netStatus = NET_NORMAL;
    } else {
        vo.netStatus = NET_ABNORMAL;
    }
    //采集状态
    if (GATHER_FLAG.equals(vo.gatherStatus)) {
        vo.gatherStatus = GATHER;
    } else {
        vo.gatherStatus = NOT_GATHER;
    }


}
return res